package com.njit.farm.controller;

import com.njit.farm.model.Result;
import com.njit.farm.model.Seed;
import com.njit.farm.service.SeedService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/seed/")
public class SeedController {

    @Resource
    SeedService seedService;


    @RequestMapping(value = "getBySid",method = RequestMethod.GET)
    public Result getBySid(@RequestParam("sId") String sId){
        return seedService.get(sId);
    }

    @RequestMapping(value = "getAll",method = RequestMethod.GET)
    public Result getAll(){
        return seedService.getAll();
    }

    @RequestMapping(value = "add",method = RequestMethod.POST)
    public Result add(@RequestBody Seed seed){
        return seedService.add(seed);
    }
}
